
{assign var="modelPlural" value=$modelClass|pluralize}
{include file="include/header.tpl" title="Browse: `$modelPlural`"}

<h1>Model: {$modelClass|pluralize}</h1>

{include file="smutty/modelNavigation.tpl"}
{include file="smutty/modelRelated.tpl" model=""}

<table>
	<tr>
		<th class="link"></th>
		{foreach item="field" from=$fields}
			<th>{$field->name|escape}</th>
		{/foreach}
	</tr>
	{foreach item="model" from=$models}
	<tr>
		<td class="link">
			<a href="{url action="modelShow" smutty_modelClass=$modelClass smutty_modelId=$model->id }" title="View Record"><img
				src="{url action="resource" folder="icons" file="show.png" }" /></a>
			<a href="{url action="modelEdit" smutty_modelClass=$modelClass smutty_modelId=$model->id }" title="Edit Record"><img
				src="{url action="resource" folder="icons" file="edit.png" }" /></a>
		</td>
		{foreach item="field" from=$fields}
			{assign var="name" value=$field->name}
			{assign var="value" value=$model->$name}
			<td>
				{if is_object($value)}
					{link url={ action="modelShow" smutty_modelClass=$name smutty_modelId=$value->id } text=$value->name }
				{else}
					{$model->$name|escape|truncate:"30"}
				{/if}
			</td>
		{/foreach}
	</tr>
	{/foreach}
</table>

{include file="include/footer.tpl"}
